{% extends 'base.html' %}
{% load humanize %}
{% block page-content %}
{% include 'nav_cat_bar.html' %}
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>权限详细信息 </h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                                <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                    <i class="fa fa-wrench"></i>
                                </a>
                                <ul class="dropdown-menu dropdown-user">
                                    <li><a href="#">Config option 1</a>
                                    </li>
                                    <li><a href="#">Config option 2</a>
                                    </li>
                                </ul>
                                <a class="close-link">
                                    <i class="fa fa-times"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <div class="row">
                              <div class="col-sm-4 m-b-xs">
                                 <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#perm_add"><i class="icon-cogs"></i>新建权限</button>
                              </div>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th class="text-center">权限名称</th>
                                        <th class="text-center">URL</th>
                                        <th class="text-center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for perm in perm_info %}
                                          <tr class="text-center">
                                            <td>{{ perm.name }}</td>
                                            <td>{{ perm.url }}</td>
                                            <td>
                                                <a href="/manager/perm_edit/?perm_name={{perm.name}}"><span class="glyphicon glyphicon-pencil"></span></a>
                                                <a href="/manager/perm_list/?perm_name={{perm.name}}&action=delete"><span class="glyphicon glyphicon-trash" style="color:red" onclick="return confirm('确认删除吗？')"></span></a>
                                            </td>
                                       
                                          </tr>
                                         {% endfor %}
                                    </tbody>
                                </table>

                                    <div class="col-sm-6">
                                    <div class="dataTables_info" id="editable_info" role="status" aria-live="polite">
                                          Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries
                                    </div>
                                   </div>
                                   {% include 'paginator.html' %}
                                </div>
	                    {% if error %}
		                    <div class="alert alert-warning text-center">{{ error }}</div>
	                    {% endif %}
	                    {% if add_info %}
                            <div class="alert alert-success text-center">{{ add_info }}</div>
	                    {% endif %}
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="perm_add" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="exampleModalLabel" align="center">添加权限</h4>
      </div>
      <div class="modal-body">
<form id="perm_form" method="post" class="form-horizontal" action="">
	<div class="form-group">
		<label for="group_name" class="col-sm-2 control-label">权限名称<span class="red-fonts">*</span></label>
		<div class="col-sm-8">
			<input id="perm_name" name="perm_name" placeholder="Group name" type="text" class="form-control" >
		</div>
	</div>
    <div class="hr-line-dashed"></div>
	<div class="form-group">
		<label for="group_name" class="col-sm-2 control-label">URL<span class="red-fonts">*</span></label>
		<div class="col-sm-8">
			<input id="perm_url" name="perm_url" placeholder="Group name" type="text" class="form-control" >
		</div>
	</div>
</form>
</div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="submit" class="btn btn-primary" form="perm_form" formmethod="post" formaction="{% url 'perm_list' %}" name="action" value="add">确定</button>
      </div>
    </div>
  </div>
</div>


{% endblock %}
